//package com.demo.statemachine.d04.InMemory;
//
//import com.demo.statemachine.d04.OrderEvents;
//import com.demo.statemachine.d04.OrderStates;
//import org.springframework.statemachine.StateMachineContext;
//import org.springframework.statemachine.StateMachinePersist;
//import org.springframework.stereotype.Component;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * 状态机持久化
// */
//
//@Component
//public class InMemoryStateMachinePersist  implements StateMachinePersist<OrderStates, OrderEvents, String> {
//    private Map<String, StateMachineContext<OrderStates, OrderEvents>> map = new HashMap<>();
//
//    @Override
//    public void write(StateMachineContext<OrderStates, OrderEvents> stateMachineContext, String key) throws Exception {
//        map.put(key, stateMachineContext);
//    }
//
//    @Override
//    public StateMachineContext<OrderStates, OrderEvents> read(String key) throws Exception {
//        return map.get(key);
//    }
//}
